<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    /* 解构 */
    // const obj = {
    //   code: 200,
    //   data: {
    //     message: '成功',
    //     list: [
    //       { id: 1, name: 'rose' },
    //       { id: 2, name: 'JACK' }
    //     ]
    //   }
    // }
    // /* 解构=====把对象中的属性当成变量来使用 */
    // console.log(obj.code);
    // console.log(obj['code']);
    // const { code: code2, data: { message, list: [a1, b1] } } = obj
    // console.log(code2, message, a1,b1);

    // var arr = [1, 2, 3, 4, 5, 6]
    // const [a, b, ...c] = arr
    // console.log(a, b, c);

    /* 扩展运算符 */
    // var arr1 = [1, 2, 3, 4]
    // var arr2 = [5, 6, 7, 8, [9, [10, [11]]]]
    // var arr3 = [arr1, arr2]
    // // var arr3 = [...arr1,...arr2]
    // // var arr3 = arr1.concat(arr2)
    // console.log(arr3.flat(Infinity));//数组扁平化

    var arr1 = ['1', '3', '/scr/3', '/scr/4']
    const arr2 = arr1.map(item => {
      // console.log(item.startsWith('/scr'));
      console.log(item.endsWith('3'));
      return item.endsWith('3') ? item : null
    })
    console.log(arr2);


  </script>
</body>

</html>